# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from fastapi import APIRouter, Depends
from hypertext import R, response_json
from apps.admin.schemas.setting.ai import secret_schema as schema
from apps.admin.service.setting.ai.secret_service import AiSecretService


router = APIRouter(prefix="/secret", tags=["AI密钥"])


@router.get("/channel", summary="AI密钥列表")
@response_json
async def channel(params: schema.AiPoolKeysChannelIn = Depends()):
    return await AiSecretService.channel(params.scene)


@router.get("/lists", summary="AI密钥列表")
@response_json
async def lists(params: schema.AiPoolKeysSearchIn = Depends()):
    return await AiSecretService.lists(params)


@router.get("/detail", summary="AI密钥详情", response_model=R[schema.AiPoolKeysDetailVo])
@response_json
async def detail(params: schema.AiPoolKeysDetailIn = Depends()):
    return await AiSecretService.detail(params.id)


@router.post("/add", summary="AI密钥新增", response_model=R)
@response_json
async def add(params: schema.AiPoolKeysAddIn):
    return await AiSecretService.add(params)


@router.post("/edit", summary="AI密钥编辑", response_model=R)
@response_json
async def edit(params: schema.AiPoolKeysEditIn):
    return await AiSecretService.edit(params)


@router.post("/delete", summary="AI密钥删除", response_model=R)
@response_json
async def delete(params: schema.AiPoolKeysIdIn):
    return await AiSecretService.delete(params.id)


@router.post("/disable", summary="AI密钥停用")
@response_json
async def disable(params: schema.AiPoolKeysIdIn):
    return await AiSecretService.disable(params.id)
